package Engine.error
{
	import flash.utils.*;
	
	public class SystemErrorCode extends Object
	{
		private static var _map:Dictionary = new Dictionary();
		public static const ExceptionCodeUnkown:int = 10000;
		public static const ExceptionOutOffMemery:int = 10001;
		public static const ExceptionCodeBase:int = 10002;
		public static const ExceptionCodeStd:int = 10003;
		public static const ExceptionCodeDateTime:int = 10004;
		public static const ExceptionCodeFunction:int = 10005;
		public static const ExceptionCodeNullHandle:int = 10006;
		public static const ExceptionCodeDB:int = 10007;
		public static const ExceptionCodeSerialize:int = 10008;
		public static const ExceptionCodeLang:int = 10009;
		public static const ExceptionCodeXml:int = 10010;
		
		public function SystemErrorCode()
		{
			this.init();
		}
		
		private function init() : void
		{
			_map[ExceptionCodeUnkown] = "未知异常";
			_map[ExceptionOutOffMemery] = "内存不足";
			_map[ExceptionCodeBase] = "基础库异常";
			_map[ExceptionCodeStd] = "标准库异常";
			_map[ExceptionCodeDateTime] = "日期格式异常";
			_map[ExceptionCodeFunction] = "基本函数异常";
			_map[ExceptionCodeNullHandle] = "空句柄异常";
			_map[ExceptionCodeDB] = "数据库异常";
			_map[ExceptionCodeSerialize] = "序列化异常";
			_map[ExceptionCodeLang] = "语言包异常";
			_map[ExceptionCodeXml] = "XML异常";
		}
		
		public static function getErrorByCode(code:int) : String
		{
			return _map[code];
		}
		
		public static function isInError(code:int) : Boolean
		{
			return code in _map;
		}
		
	}
}
